package com.example.demo.demos;



import com.example.demo.demos.test.MyBootStrapRegistry;
import com.example.demo.demos.test.MyBootStrapRegistry2;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.BootstrapRegistryInitializer;

public class myBootstrapRegistryIntializer implements BootstrapRegistryInitializer {
    @Override
    public void initialize(BootstrapRegistry registry) {
        System.out.println("myBootstrapRegistryIntializer。。。。");
        System.out.println("Bootstrap注册开始");
        registry.register(MyBootStrapRegistry.class, BootstrapRegistry.
                InstanceSupplier.of(new MyBootStrapRegistry()));
        registry.register(MyBootStrapRegistry.class, BootstrapRegistry.
                InstanceSupplier.from(MyBootStrapRegistry::new)
                .withScope(BootstrapRegistry.Scope.PROTOTYPE));
        registry.register(MyBootStrapRegistry2.class,BootstrapRegistry.
                InstanceSupplier.of(new MyBootStrapRegistry2()));
        registry.register(MyBootStrapRegistry2.class, BootstrapRegistry.
                InstanceSupplier.from(MyBootStrapRegistry2::new)
                .withScope(BootstrapRegistry.Scope.PROTOTYPE));
    }
}
